<?php
/**
 *
 * @category   babel 
 * @package    BABEL
 * @author     Hannes Magnusson <hannes.magnusson@gmail.com>
 * @copyright  2008 Team babel
 * @license    LGPL
 */

class BabelConstant {
	private $name = null;
	private $value = null;
	private $revision = "Thu, 01 Jan 1970 00:00:01 +0000";
	private $context = null;
	private $type = null;

	public function __construct($name, $value, $revision, array $props) {
		$this->name     = $name;
		$this->value    = trim($value);
		$this->revision = $revision;
		$this->context  = $props["context"];
		$this->type     = $props["type"];
	}
	public function __get($var) {
		if (isset($this->{$var})) {
			return $this->{$var};
		}
		return null;
	}
	public function __call($var, $args) {
		if (strncasecmp($var, "get", 3) === 0) {
			return $this->{strtolower(substr($var, 3))};
		}
		throw new Exception("Unknown property requested");
	}
	public function __toString() {
		return $this->name;
	}
}

